package com.tql.mall.web.controller;

import com.tql.mall.boss.client.BossFeignClient;
import com.tql.mall.common.constant.PageConstant;
import com.tql.mall.model.product.level.FirstLevel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @Author: tyk
 * @Date: 2023/5/22 16:50
 * @Description:
 */
@Controller
public class IndexWebController {

    @Autowired
    private BossFeignClient bossFeignClient;

    /**
     * 首页
     */
    @GetMapping({"/", "index.html"})
    public String index(Model model) {
        // 获取首页分类数据
        List<FirstLevel> allClassifyInfo = bossFeignClient.getAllClassifyInfo();
        model.addAttribute(PageConstant.CATEGORY_LIST, allClassifyInfo);
        return "index/index";
    }

    /**
     * 测试服务
     */
    @GetMapping({"test.html"})
    public String test() {
        return "index/testServer";
    }

}
